package com.xiaobai.spike.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ProductMapper {
    @Select("select count from product where id = #{id}")
    Integer getLowCount(Integer id);

    @Update("update product set count = count - 1 where id = #{id} and count > 0")
    Integer success(Integer id);

}
